package com.youlu.campus.wechat.enums;

import com.wechat.pay.java.core.http.HttpMethod;
import org.apache.commons.lang3.ArrayUtils;

/**
 * 微信商户投诉 相关api接口
 *
 * @Description: WechatComplaintConstant
 * @Date 2025/6/18
 * @author: su
 */
public enum WechatComplaintApiEnum {

    //实时投诉
    CREATE_NOTIFY_URL(getHttpsPath() + "/v3/merchant-service/complaint-notifications", HttpMethod.POST, "创建投诉通知回调地址"),
    QUERY_NOTIFY_URL(getHttpsPath() + "/v3/merchant-service/complaint-notifications", HttpMethod.GET, "查询投诉通知回调地址"),
    DELETE_NOTIFY_URL(getHttpsPath() + "/v3/merchant-service/complaint-notifications", HttpMethod.DELETE, "删除投诉通知回调地址"),

    //主动查询投诉信息
    QUERY_COMPLAINT_LIST(getHttpsPath() + "/v3/merchant-service/complaints-v2", HttpMethod.GET, "查询投诉单列表"),
    QUERY_COMPLAINT_DETAIL(getHttpsPath() + "/v3/merchant-service/complaints-v2/%s", HttpMethod.GET, "查询投诉单详情"),
    QUERY_COMPLAINT_NEGOTIATION_HISTORY(getHttpsPath() + "/v3/merchant-service/complaints-v2/%s/negotiation-historys", HttpMethod.GET, "查询投诉单协商历史"),


    //处理用户投诉信息
    RESPONSE_COMPLAINT(getHttpsPath() + "/v3/merchant-service/complaints-v2/%s/response", HttpMethod.POST, "回复用户"),
    COMPLETE_COMPLAINT(getHttpsPath() + "/v3/merchant-service/complaints-v2/%s/complete", HttpMethod.POST, "反馈处理完成"),

    ;
    private static final String HTTPS_PATH = "https://api.mch.weixin.qq.com";

    private static String getHttpsPath() {
        return HTTPS_PATH;
    }


    private String url;

    private HttpMethod method;

    private String desc;

    WechatComplaintApiEnum(String url, HttpMethod method, String desc) {
        this.url = url;
        this.method = method;
        this.desc = desc;
    }

    public String getUrl(String... pathParams) {
        if (ArrayUtils.isEmpty(pathParams)) {
            return this.url;
        }
        return String.format(this.url, pathParams);
    }

    public HttpMethod getMethod() {
        return method;
    }

    public String getDesc() {
        return desc;
    }
}
